Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Cluster Actuator Implementation #17

Merged
merged 12 commits into from
Oct 22, 2018

Conversation

marwanad
Copy link
Member

@marwanad marwanad commented Oct 16, 2018

This moves the responsibility of creating and reconciling the NSG to the cluster actuator. (I'll be moving the VNet in a separate PR).

I tested the reconciliation to the SSH rule by deleting the rule through the portal and waiting for the cluster controller to reconcile.

Working towards #9

Defines a top-level AzureClient interface to hold all clients and operations for
creating and checking for existence of an NSG
This is now handled by the cluster actuator
}

func (azure *AzureClusterClient) Delete(cluster *clusterv1.Cluster) error {
//TODO: get rid of the whole resource group?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this be the right thing to do? Figuring out the dependencies in the cluster between virtual machines and the created NICs and SG would be a hassle. Would there be a case when the Delete operation shouldn't be tearing down all cluster resources?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think deleting the whole resource group sounds like a good initial implementation. Figuring out resource dependencies is a nightmare and I don't see a use case where a Delete operation shouldn't delete all cluster resources.

if err != nil {
return err
}
networkSGFuture, err := azure.network().CreateOrUpdateNetworkSecurityGroup(clusterConfig.ResourceGroup, "ClusterAPINSG", clusterConfig.Location)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should move this to a const under securitygroups.go and default to that name if no SG name is provided.

Refer to that defined constant from machineactuator.go as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please. Even better if we have a module just for constants.

@vannrt
Copy link
Contributor

vannrt commented Oct 16, 2018

Hi @marwanad, I'll get back to you with a review later today. In the meantime, can you check your PR's Travis build: https://travis-ci.org/platform9/azure-provider/builds/442404123?

@marwanad marwanad force-pushed the cluster-actuator-nsg branch from 198736b to eef1efe Compare October 17, 2018 17:54
@marwanad marwanad force-pushed the cluster-actuator-nsg branch from eef1efe to 25ece3b Compare October 17, 2018 21:58
Copy link
Contributor

@vannrt vannrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass. Overall LGTM. We don't have a style guide right now but we should adopt one. The long lines doesn't work well with GitHub's rather large paddings so I find myself scrolling to the right to see an entire line.

if err != nil {
return err
}
networkSGFuture, err := azure.network().CreateOrUpdateNetworkSecurityGroup(clusterConfig.ResourceGroup, "ClusterAPINSG", clusterConfig.Location)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please. Even better if we have a module just for constants.

}

func (azure *AzureClusterClient) Delete(cluster *clusterv1.Cluster) error {
//TODO: get rid of the whole resource group?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think deleting the whole resource group sounds like a good initial implementation. Figuring out resource dependencies is a nightmare and I don't see a use case where a Delete operation shouldn't delete all cluster resources.

cloud/azure/services/network/service.go Show resolved Hide resolved
@@ -64,6 +65,12 @@ func (azure *AzureClusterClient) Reconcile(cluster *clusterv1.Cluster) error {
if err != nil {
return fmt.Errorf("error loading cluster provider config: %v", err)
}

_, err = azure.resourcemanagement().CreateOrUpdateGroup(clusterConfig.ResourceGroup, clusterConfig.Location)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the resource group creation and updating should be part of the cluster reconciliation loop

@marwanad marwanad force-pushed the cluster-actuator-nsg branch from 61e8dc1 to be783ba Compare October 20, 2018 01:41
Copy link
Contributor

@vannrt vannrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@vannrt vannrt merged commit 6909867 into kubernetes-sigs:master Oct 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants